---
import { BaseLayout } from '../layouts';
import { DeepseekChatContent } from '../components/chat';
import { DEEPSEEK_CHAT_CONTENT } from '../content';
import { getCurrentLang } from '../utils';
import { CHAT_PAGE_PATH, SITE_BASE_URL, STYLE_PATHS, VIEWPORT_ZOOM_ALLOWED } from '../constants';
import '../styles/components/deepseek_chat.css';
import '../styles/components/modal.css';

const langDefault = getCurrentLang();
const langKey = langDefault.startsWith('zh') ? 'zh' : 'en';
const pageTexts = DEEPSEEK_CHAT_CONTENT[langKey];
const titleZh = DEEPSEEK_CHAT_CONTENT.zh.title;
const titleEn = DEEPSEEK_CHAT_CONTENT.en.title;
---

<BaseLayout
  lang={langDefault}
  titleZh={titleZh}
  titleEn={titleEn}
  title={pageTexts.title}
  description={`${pageTexts.description} Conversations are saved locally and support Markdown rendering.`}
  viewport={VIEWPORT_ZOOM_ALLOWED}
  canonical={`${SITE_BASE_URL}${CHAT_PAGE_PATH}/`}
  showChatWidget={false}
  preloadStyles={[
    STYLE_PATHS.GITHUB_CODE_HIGHLIGHT,
    STYLE_PATHS.GITHUB_MARKDOWN_LIGHT,
    STYLE_PATHS.MARKDOWN_DARK_MODE
  ]}
  extraStyles={[
    STYLE_PATHS.GITHUB_CODE_HIGHLIGHT,
    STYLE_PATHS.GITHUB_MARKDOWN_LIGHT,
    STYLE_PATHS.MARKDOWN_DARK_MODE
  ]}
  og={{ url: `${SITE_BASE_URL}${CHAT_PAGE_PATH}/` }}
>
  <Fragment slot="bodyEnd">
    <script>
      if (window.self !== window.top) {
        document.body.classList.add('is-embedded');
      }
    </script>
  </Fragment>

  <DeepseekChatContent client:load />
</BaseLayout>
